package com.lzx.loginandregister.controller;

import com.lzx.loginandregister.entity.User;
import com.lzx.loginandregister.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    //登录
    @PostMapping("/login")
    public Map<String, Object> login(@RequestBody User user) {
        return userService.login(user);
    }

    //注册
    @PostMapping("/register")
    public String register(@RequestBody User user) {
        return userService.register(user);
    }
}
